//
//  SALableWKWebVC.m
//  saasRetail
//
//  Created by 黄志刚 on 2022/1/6.
//

#import "SALableWKWebVC.h"
#import <WebKit/WebKit.h>

@interface SALableWKWebVC ()<WKUIDelegate,WKNavigationDelegate>

@property (nonatomic, strong) NSString *titleStr;
@property (nonatomic, strong) NSString *lableStr;
@property (nonatomic, strong) WKWebView *webView;

@end

@implementation SALableWKWebVC

-(instancetype)initWithTitle:(NSString *)title AndLable:(NSString *)lab {
    if (self = [super init]) {
        self.titleStr = title;
        self.lableStr = lab;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

-(void)initUI {
    [self setNavigationItemBackBBIAndTitle:self.titleStr];
    [self setBgImage:nil];
    
    WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, kScaleNum(StatusHeight), kScreenWidth, kScreenHeight - kScaleNum(StatusHeight))];
    self.webView = webView;
    webView.UIDelegate = self;
    webView.navigationDelegate = self;
    NSString *html_str = self.lableStr;
    [webView loadHTMLString:html_str baseURL:nil];
    [self.view addSubview:webView];
    
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
{
    //修改字体大小 300%
    [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '300%'"completionHandler:nil];
    
    //修改字体颜色  #9098b8
//    [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextFillColor= '#222222'"completionHandler:nil];
    
}

@end
